Skip to content

feat(compat.vulkan-validation-layers): the Khronos validation layer for mcpp-built programs - #406

Draft
Sunrisepeak wants to merge 1 commit into
mainfrom
feat/vulkan-validation-layers
Draft

Sunrisepeak wants to merge 1 commit into
mainfrom
feat/vulkan-validation-layers

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Summary

新增 compat.vulkan-validation-layers(shape I,生态绑定,和 compat.libgbm 同形):把 xim:vulkan-validation-layers(openxlings/xim-pkgindex 的 VK_LAYER_KHRONOS_validation payload)作为 runtime 依赖带进项目环境,让 mcpp 构建的程序在 debug 下能开 validation,而不去碰宿主的 /usr/lib

为什么:mcpp 产物跑在生态的 glibc 上,宿主装的 layer 能被 loader 按 manifest 找到、却 dlopen 不到(裸 soname,不在 rpath),vkCreateInstance 失败。驱动走 compat.vulkan-runtime 桥接是因为只能来自机器;layer 是普通软件,进生态。

形态:无自有源码,一个 anchor(上游该 tag 的 LICENSE.txt,镜像到 mcpp-res/vulkan-validation-layers,sha 一致),deps.runtime = xim:vulkan-validation-layers@1.4.357.0。消费者写在 [dev-dependencies]

发现:xim 配方把 manifest 放进 subos 的 share/vulkan/explicit_layer.d 并声明 XDG_DATA_DIRS;mcpp 把 subos 声明带进 mcpp run / mcpp test(mcpp#352),引擎不用改。

feature:无。

测试 tests/examples/vulkan-validation-layers:loader 枚举到该 layer,vkEnumerateInstanceExtensionProperties(layer) 让 loader 真正加载 .so 并返回 VK_EXT_debug_utils;不创建 instance,无 GPU 的 runner 上成立。Linux only,其它平台 no-op main。

设计记录:.agents/docs/2026-09-13-add-vulkan-validation-layers-plan.md

Test plan

  • 本地 lint(check_mirror_urlscheck_package_namemcpp xpkg parse @ CI 版本)通过;mcpp test -p vulkan-validation-layers 通过(输出见下)。
  • CI:lint、mirror-cn-reachable、workspace 选中 vulkan-validation-layers 成员。
  • 前置:xim-pkgindex 的配方 PR 已合并并发布索引(否则 xim: 依赖解析不到)。

前置:openxlings/xim-pkgindex#835 合并并发布索引之后,这里的 workspace 检查才能通过(xim:vulkan-validation-layers 目前 "not published yet",本地已复现同一错误)。lint 和 mirror 检查不依赖它。

…or mcpp-built programs, bound to xim:vulkan-validation-layers

A debug build asks the loader for VK_LAYER_KHRONOS_validation; the host's
copy is found by manifest and lost at dlopen, because an mcpp-built
program runs on the ecosystem's glibc whose loader never searches
/usr/lib. Drivers are bridged from the host (compat.vulkan-runtime)
because they can only come from the machine; a layer is ordinary software
and is a payload of the ecosystem, so this package is the binding: an
anchor, a runtime dependency on the xim payload, and nothing to link.

Discovery is the xim recipe's: the manifest in the subos's
share/vulkan/explicit_layer.d, the subos share on XDG_DATA_DIRS, and mcpp
carrying subos declarations into the programs it launches (mcpp#352).

tests/examples/vulkan-validation-layers asserts the loader enumerates the
layer and can load its library (vkEnumerateInstanceExtensionProperties
by layer name), on a runner with no GPU.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant